package service.impl;

import dao.FileDao;
import domain.VirtualFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import service.FileService;

import java.util.List;

@Service
public class FileServiceImpl implements FileService {

    @Autowired
    private FileDao fileDao;
    
    @Override
    public boolean save(VirtualFile virtualFile) {
        fileDao.save(virtualFile);
        return true;
    }
    
    @Override
    public List<VirtualFile> getByName_desc(String fname) {
    
        return fileDao.getByName_desc(fname);
    }
    
    @Override
    public boolean getByMD5(String MD5) {
        return fileDao.getByMD5(MD5) != null;
    }
    
    @Override
    public List<VirtualFile> getAll() {
    	// 查询所有文件信息
        return fileDao.getAll();
    }
    
    @Override
    public List<VirtualFile> getBySpeciality(String speciality) {
        return fileDao.getBySpeciality(speciality);
    }
    
    @Override
    public VirtualFile getById(Integer id) {
        return fileDao.getById(id);
    }

    @Override
    public void setNewOwner(int uid, int i) {
        fileDao.setNewOwner(uid,i);
    }
}
